package com.nenude.corejava.ch7.newhomework2;

//设计一个父类，保存学生的共同属性
public class Student implements IGradeAssessing, IShow {
	// 学号
	private int studentid;
	// 姓名
	private String name;
	// 性别
	private String sex;
	// 年龄
	private int age;

	// 期中考试成绩
	private double midterGrade;
	// 期末考试成绩
	private double finalExamGrade;

	// 封装

	@Override
	// 默认的成绩是：其中考试和期末
	public double gradeAssessing() {
		return (midterGrade + finalExamGrade) / 2;
	}

	public Student(int studentid, String name, String sex, int age,
			double midterGrade, double finalExamGrade) {
		super();
		this.studentid = studentid;
		this.name = name;
		this.sex = sex;
		this.age = age;
		this.midterGrade = midterGrade;
		this.finalExamGrade = finalExamGrade;
	}

	public Student() {
		super();
		// TODO Auto-generated constructor stub
	}

	public int getStudentid() {
		return studentid;
	}

	public void setStudentid(int studentid) {
		this.studentid = studentid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public double getMidterGrade() {
		return midterGrade;
	}

	public void setMidterGrade(double midterGrade) {
		this.midterGrade = midterGrade;
	}

	public double getFinalExamGrade() {
		return finalExamGrade;
	}

	public void setFinalExamGrade(double finalExamGrade) {
		this.finalExamGrade = finalExamGrade;
	}

	@Override
	public void showInfo() {
		System.out.print("学号：" + getStudentid() + ", ");
		System.out.print("姓名：" + getName() + ", ");
		System.out.print("性别：" + getSex() + ", ");
		System.out.print("年龄：" + getAge() + ", ");
		System.out.println("综合成绩：" + gradeAssessing());

	}

}
